﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="krj_document_download.aspx.cs" Inherits="krj_document_download" %>

<%@ Register Src="~/UserControls/ucGridViewPager.ascx" TagName="ucGridViewPager" TagPrefix="Kerry" %>
<%@ Register src="~/UserControls/ucFavorite.ascx" tagname="ucFavorite" tagprefix="Kerry" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
  <script>
    function CleanMessage() {
      document.getElementById("MainContent_lbl_message").innerHTML = "";
    }
  </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="Server">
  <div>
    <table class="ConditionTable">
      <th><Kerry:ucFavorite ID="ucFavorite" runat="server"/>表單下載
      </th>
      <tr>
        <td>下載表單職工代號 :
                    <asp:TextBox ID="txt_user_no" runat="server" />
          [ 若為代他人下載表單，請填入其職工代號 ]
                    <br />
          <asp:Label ID="lbl_message" runat="server" EnableViewState="False" ForeColor="Red" />
        </td>
      </tr>
    </table>
    <br />
    <asp:GridView ID="gv_document" runat="server" AutoGenerateColumns="False" DataKeyNames="DOCUMENT_CATEGORY,DOCUMENT_NO" DataSourceID="SDS_KRJ_DOCUMENT" AllowPaging="True" OnRowDataBound="gv_document_RowDataBound" OnSelectedIndexChanged="gv_document_SelectedIndexChanged" PageSize="20">
      <Columns>
        <asp:BoundField DataField="DOCUMENT_CATEGORY" HeaderText="DOCUMENT_CATEGORY" ReadOnly="True" SortExpression="DOCUMENT_CATEGORY" Visible="False" />
        <asp:TemplateField HeaderText="部門代號" SortExpression="DOCUMENT_NO" HeaderStyle-Width="150">
          <ItemTemplate>
            <asp:Label ID="lbl_DEPT_ID" runat="server" Text='<%# Bind("DEPT_ID") %>'></asp:Label>
            <asp:Label ID="lbl_DEPT_ID_NAME" runat="server" Text='<%# Bind("DEPT_NAME") %>'  />
          </ItemTemplate>
          <HeaderStyle Width="150px"></HeaderStyle>
        </asp:TemplateField>
          <asp:TemplateField HeaderText="表單類別" SortExpression="DOCUMENT_NO" HeaderStyle-Width="150">
          <ItemTemplate>
            <asp:Label ID="lbl_DOCUMENT_CATEGORY" runat="server" Text='<%# Bind("DOCUMENT_CATEGORY") %>'></asp:Label>
            <asp:Label ID="lbl_DOCUMENT_CATEGORY_NAME" runat="server" Text='<%# Bind("DOCUMENT_CATEGORY_NAME") %>' />
          </ItemTemplate>
          <HeaderStyle Width="150px"></HeaderStyle>
        </asp:TemplateField>
          <asp:TemplateField HeaderText="表單代號" SortExpression="DOCUMENT_NO" HeaderStyle-Width="150">
          <ItemTemplate>
            <asp:Label ID="lbl_DOCUMENT_NO" runat="server" Text='<%# Bind("DOCUMENT_NO") %>'></asp:Label>
            
          </ItemTemplate>
          <HeaderStyle Width="150px"></HeaderStyle>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="表單名稱" SortExpression="DOCUMENT_NAME">
          <ItemTemplate>
            <asp:Label ID="lbl_DOCUMENT_NAME" runat="server" Text='<%# Bind("DOCUMENT_NAME") %>' />
            <asp:Label ID="lbl_ISSEQUENCE" runat="server" Text='<%# Bind("ISSEQUENCE") %>' Visible="false" />
            <asp:Label ID="lbl_ISMAIL" runat="server" Text='<%# Bind("ISMAIL") %>' Visible="false" />
            <asp:Label ID="lbl_ISSTATISTICS" runat="server" Text='<%# Bind("ISSTATISTICS") %>' Visible="false" />
            <asp:Label ID="lbl_ISTRANSFORM" runat="server" Text='<%# Bind("ISTRANSFORM") %>' Visible="false" />
          </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="表單文件" SortExpression="ISPATH">
          <ItemTemplate>
            <asp:Label ID="lbl_ISATTACHMENT" runat="server" Text='<%# Bind("ISATTACHMENT") %>' Visible="false" />
            <asp:Label ID="lbl_ISPATH" runat="server" Text='<%# Bind("ISPATH") %>'></asp:Label>
            <asp:Label ID="lbl_filepath" runat="server" Text='<%# Bind("ISPATH") %>' Visible="false" />
            <asp:Label ID="lbl_UPD_DOCUMENT_NO" runat="server" Text='<%# Bind("UPD_DOCUMENT_NO") %>' Visible="false" />
          </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="CRT_ID" HeaderText="CRT_ID" SortExpression="CRT_ID" Visible="False" />
        <asp:BoundField DataField="CRT_DATE" HeaderText="CRT_DATE" SortExpression="CRT_DATE" Visible="False" />
        <asp:BoundField DataField="CRT_TIME" HeaderText="CRT_TIME" SortExpression="CRT_TIME" Visible="False" />
        <asp:BoundField DataField="UPD_ID" HeaderText="UPD_ID" SortExpression="UPD_ID" Visible="False" />
        <asp:TemplateField HeaderText="異動時間" SortExpression="UPD_DATE">
          <ItemTemplate>
            <asp:Label ID="lbl_UPD_DATE" runat="server" Text='<%# Bind("UPD_DATE") %>'></asp:Label>
            - 
                        <asp:Label ID="lbl_UPD_TIME" runat="server" Text='<%# Bind("UPD_TIME") %>'></asp:Label>
          </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Download" HeaderStyle-Width="48" ItemStyle-BackColor="White">
          <ItemTemplate>
            <asp:ImageButton ID="ib_download" runat="server" CausesValidation="False" CommandName="Select" ImageUrl="~/Images/download.jpg" Width="48" Text="下載" ToolTip="Download" OnClientClick="CleanMessage();" />
          </ItemTemplate>
          <HeaderStyle Width="36px"></HeaderStyle>
          <ItemStyle BackColor="White"></ItemStyle>
        </asp:TemplateField>
      </Columns>
      <PagerTemplate>
        <Kerry:ucGridViewPager ID="ucPager" runat="server" />
      </PagerTemplate>
    </asp:GridView>
    <asp:SqlDataSource ID="SDS_KRJ_DOCUMENT" runat="server"
      ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
      ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"
      SelectCommand="SELECT A.dept_id, B.DEPT_NAME, A.document_category, A.document_no, C.document_name, A.issequence, A.ismail, A.isstatistics, A.istransform, A.isattachment, A.ispath, A.upd_document_no, A.undertakers, A.download_year, A.crt_id, A.crt_date, A.crt_time, A.upd_id, A.upd_date, A.upd_time,C.DOCUMENT_CATEGORY_NAME FROM TG.KRJ_DOCUMENT A  LEFT JOIN MIS_DEPT_AP B on A.DEPT_ID = B.DEPT_ID  LEFT JOIN krj_category_document C on A.DEPT_ID = C.DEPT_ID and A.DOCUMENT_CATEGORY = C.DOCUMENT_CATEGORY and A.DOCUMENT_NO = C.DOCUMENT_NO WHERE 1=1 "></asp:SqlDataSource>
  </div>
<%--  <asp:Panel ID="PanelMail" runat="server" Visible="false">
    親愛的主管 您好： 
        <br />
    您的同仁<asp:Label ID="lbl_receiver" runat="server"/>
    下載<asp:Label ID="lbl_form" runat="server"/>表單，敬請知悉，謝謝!
  </asp:Panel>
  <asp:Panel ID="PanelUnderTakers" runat="server" Visible="false">
    親愛的承辦人 您好： 
        <br />
    <asp:Label ID="lbl_taker_dept" runat="server"/>-<asp:Label ID="lbl_taker" runat="server"/>
    下載<asp:Label ID="lbl_taker_form" runat="server"/>表單，敬請知悉，謝謝!
  </asp:Panel>--%>
</asp:Content>

